import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//注解
@WebServlet("/views/course.action")
public class MyServletResponse extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置响应状态码302
        resp.setStatus(302);
        //设置响应头信息
        //重定向的地址 Location
        //重定向的地址要写完整   跳转：昨天内容跳转是自动匹配虚拟目录
        //重定向地址：虚拟目录＋请求路径
//       resp.setHeader("Location","/day31/views/login.html");
        resp.sendRedirect("/day31/views/login.html");
    }

}
